UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uBjw2cGM9ExnkQj3FDM55cfKx25evRvoNWPq5/y8LJQ=' 
WHERE 
  key_id = '142539ec674c9b3e1322df25954653af8401c67ef6994857afb7140598ecfc4f' 
  AND (
    token = 'uBjw2cGM9ExnkQj3FDM55cfKx25evRvoNWPq5/y8LJQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021