UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WTN1sLouqc1IohIQdG83Caom6ADbY+bLRzNFBMchvvQ='
WHERE
key_id = 'b040fae2812d7fe71cf6a4e457b41d7c14464e2a4d2553c08e9f4b6176188f3b'
AND (
token = 'WTN1sLouqc1IohIQdG83Caom6ADbY+bLRzNFBMchvvQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)