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

Query time 0.00031