UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'crp5gkRg+vG7DwqXCdEVvAKxRFMDDDtwmoVgZ08CTiA=' 
WHERE 
  key_id = '1239e119f6b461a58639399b03aa41bd213051339d4e490311584357ba93cbde' 
  AND (
    token = 'crp5gkRg+vG7DwqXCdEVvAKxRFMDDDtwmoVgZ08CTiA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028