UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sAV52fzNlABpUhSDzE5qTi32mgEM/SPTnXhAGlTpp58='
WHERE
key_id = 'd1f8be1cd34b59ce524ef375fd32b70f87fdce97b929610c4bcadabcaae745b3'
AND (
token = 'sAV52fzNlABpUhSDzE5qTi32mgEM/SPTnXhAGlTpp58='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)