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

Query time 0.00021