UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1SfeMFy81qG4yA+ORq37a563U96mZfzycI68cWSaa9w='
WHERE
key_id = '01af10afbf13ffd057d5c8dd17d854a47217414e54e746936d169dc9c02bbfbb'
AND (
token = '1SfeMFy81qG4yA+ORq37a563U96mZfzycI68cWSaa9w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)