UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TwkcatqIy46Ih9z5GxmNFn43wjAjd3w+0nTIW8rwBRY='
WHERE
key_id = '7de91304d6e7d050462f48ec9192ce8e5acbef2223eea657a4e186653acd4730'
AND (
token = 'TwkcatqIy46Ih9z5GxmNFn43wjAjd3w+0nTIW8rwBRY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)