UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZafnqOyysdy2AzKxJSCrDbTendTriWgxRCiRVG9wakY=' 
WHERE 
  key_id = '563769e961c89ad123897f7af37f8b59a7b75b97cf51c5fe2b2b7a1e3b2528e5' 
  AND (
    token = 'ZafnqOyysdy2AzKxJSCrDbTendTriWgxRCiRVG9wakY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025