UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J04hN9LsmwIBnKxYwV0GsVhTET98eEVkBKDejP7puic=' 
WHERE 
  key_id = 'a962d5be9f93415f0bf76dd4988fa1441d27a96c17b3b2d4d76ce44e88496e07' 
  AND (
    token = 'J04hN9LsmwIBnKxYwV0GsVhTET98eEVkBKDejP7puic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023