UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tV9IMUvoAMTgKB2LMXHFamXgS0Ho5mna5j4DDSPWHxE=' 
WHERE 
  key_id = '4a1507d66ea0d1e91c325c642e8e0f31f047dae9c1a1dd08ff3a6c095c7491a6' 
  AND (
    token = 'tV9IMUvoAMTgKB2LMXHFamXgS0Ho5mna5j4DDSPWHxE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026