UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Xu3Cv3sV9rHQ7WBcdq919LezK7yq+SJhf//QttVQky4='
WHERE
key_id = 'd9950b64c1557f818c0b1d40bff45a5a1fa8fcccc3f996710533d7603be25c30'
AND (
token = 'Xu3Cv3sV9rHQ7WBcdq919LezK7yq+SJhf//QttVQky4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)