UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '35JCOOPAe0e8+ZcP1zIGSGvRwKE0NrXTmFLuuvQNlJk=' 
WHERE 
  key_id = '416b186d03510af96584d6f0bc13ec6eacb56dfc7bb4a43b1326aa4605b01345' 
  AND (
    token = '35JCOOPAe0e8+ZcP1zIGSGvRwKE0NrXTmFLuuvQNlJk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044