UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wZ2w7XauUyXLKe/jOfdjvSCi1gk9y42+mgxFb3Ptq0Y=' 
WHERE 
  key_id = 'a0a9f5203cc11a5c00efe593cd8c67bfcec923c15b69d41deb6d08cd21e16809' 
  AND (
    token = 'wZ2w7XauUyXLKe/jOfdjvSCi1gk9y42+mgxFb3Ptq0Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035