UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/oZjruQBE3fs0Z9Z6SOEHubhfG8d4ZuFmAqQOG1xYaQ='
WHERE
key_id = '3465c30488e0045646524c4ce25cf08a821e00a7f74f8a571541ae9886332ee2'
AND (
token = '/oZjruQBE3fs0Z9Z6SOEHubhfG8d4ZuFmAqQOG1xYaQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)