UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pzB2FelnXQIXgekTivrO4x9h1A/060pI1/e7A1v+fow=' 
WHERE 
  key_id = '986efd9205fac2f0dcefebe1194b3724ee76b3e289169fdf425ab5df3e18de5f' 
  AND (
    token = 'pzB2FelnXQIXgekTivrO4x9h1A/060pI1/e7A1v+fow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025