UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5J1Fs2VVAIHRCCsgXRYeJ4ekdweYy+sPiycl7orTBkI='
WHERE
key_id = '3bd2aa6d25ca210659b5a91b90e5bba96d656deacc2984422d745d42610da12b'
AND (
token = '5J1Fs2VVAIHRCCsgXRYeJ4ekdweYy+sPiycl7orTBkI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)