UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'carwNpRrVPGTVfnE+qQtkd9FgATus0JczvsGzHc8wV0='
WHERE
key_id = '8dbcdf40eed6221f6bf89be825df70ba646200463902c02f8a8ce10c39fe6dac'
AND (
token = 'carwNpRrVPGTVfnE+qQtkd9FgATus0JczvsGzHc8wV0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)