UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CaYu9gkhNo7H6Ec2IcYsp5ti53l7vs5gyCuwhPr1720='
WHERE
key_id = '3538e70e9c260d9689a521f122e0cc388189b01607bbeeb61d1e54570ce02e37'
AND (
token = 'CaYu9gkhNo7H6Ec2IcYsp5ti53l7vs5gyCuwhPr1720='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)