UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1aDToZc6vqdrLpdB3hlAbkxyn+dvvEimGu65/eFDHMM=' 
WHERE 
  key_id = '388799eb075d0c15a5bab59363a05896a4c2c919be0fe92e387d15c5df257555' 
  AND (
    token = '1aDToZc6vqdrLpdB3hlAbkxyn+dvvEimGu65/eFDHMM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053