UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fknO+rjeafAmxGpXrBqfT4O0yBowoFVJnBhswH3O4IE=' 
WHERE 
  key_id = 'fbe644866545bee03e07e139e27ae60c2fb97465f14cd2b2facd3adb80b15830' 
  AND (
    token = 'fknO+rjeafAmxGpXrBqfT4O0yBowoFVJnBhswH3O4IE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045