UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V3d88P89vLPFvm1u1uT9ZWJT0tLChHlCD4H5NCmzz58='
WHERE
key_id = '1d40f86b34cf03668b84869a09cfe3daacf348ad13e81d5bdee7945a025fe839'
AND (
token = 'V3d88P89vLPFvm1u1uT9ZWJT0tLChHlCD4H5NCmzz58='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)