UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YLNKRYNIn2wdGHXjGDS0ahUAMcw/EOUQ2Sryj6X/gww='
WHERE
key_id = 'ccc6537cf0531d610bc5a4a317bfc21b0f092981a53839611232fdec05a5b68f'
AND (
token = 'YLNKRYNIn2wdGHXjGDS0ahUAMcw/EOUQ2Sryj6X/gww='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)