UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o89e3Nvl76jjAHTABbiX/zRFDwAHbvChrlACpI+vz4c=' 
WHERE 
  key_id = '85b5318568691c45f0068c5b749394749c39c83d1663fd82eb3c7ffa636b5cda' 
  AND (
    token = 'o89e3Nvl76jjAHTABbiX/zRFDwAHbvChrlACpI+vz4c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036