UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wNZCBSGC1irKZMw+OlJQGWE7Gh2kxT8VbjZyvPmeRA0='
WHERE
key_id = '88e88399bd3a479a7106d47ec6d752503745010d3ca5adb424b0b8e0743fa6cd'
AND (
token = 'wNZCBSGC1irKZMw+OlJQGWE7Gh2kxT8VbjZyvPmeRA0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)