UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BgOhVNzonYhUGPT8Xul3Gm+GbJvF8XHxjjkB/7jVLvU='
WHERE
key_id = '4471c515ba98eb5da82152452e53ede3df5e489540204688c3a93847c7f93f8b'
AND (
token = 'BgOhVNzonYhUGPT8Xul3Gm+GbJvF8XHxjjkB/7jVLvU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)