UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fkMb1yxa7P1ieGifoKiV8cIgOPkprK0ctnqzky3kGug=' 
WHERE 
  key_id = '7e09bf0d2a187779394f7c35d8063406e83d2c9ba036fc554eff47b143991e99' 
  AND (
    token = 'fkMb1yxa7P1ieGifoKiV8cIgOPkprK0ctnqzky3kGug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00067