UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a0Jgmhn0tL3voRy4iBO/7mtvcuTg6Bo0B04bcCuKogc=' 
WHERE 
  key_id = '99d07748346e05b3e49b4516a24e1387635ab8ad601b09093f8fa7abe7717ca2' 
  AND (
    token = 'a0Jgmhn0tL3voRy4iBO/7mtvcuTg6Bo0B04bcCuKogc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044