UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BG9VxXrrvXz+hWdvqFlqgOWbdnW1hzlwHKJBGMhZNvk='
WHERE
key_id = 'f50e334de79ecb7c3819bd5f902be4167cf71c65920e5d76fa0087c0ceeef9e2'
AND (
token = 'BG9VxXrrvXz+hWdvqFlqgOWbdnW1hzlwHKJBGMhZNvk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)