UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y6uwidV3CpIc5t2UEzBfpptoNeHAbs9kDnR0bSc+QoA='
WHERE
key_id = '82e908cada6ffcfbb92838acfb140fe00d40f7cf4d493e38074153c1a6adc599'
AND (
token = 'y6uwidV3CpIc5t2UEzBfpptoNeHAbs9kDnR0bSc+QoA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)