UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'scVypnxbL7IejFP2+F6hUTMAEmTG7pI4XE1WirAhWXA=' 
WHERE 
  key_id = '241bf0dadc5212b7716a98fef13d93615363fcf75908ae251060274e29213c94' 
  AND (
    token = 'scVypnxbL7IejFP2+F6hUTMAEmTG7pI4XE1WirAhWXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031