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

Query time 0.00062