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

Query time 0.00030