UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KVRGD1NzKWApoz8Oru+oQvFov0U6e2TstM0nRDb9H3w='
WHERE
key_id = 'f9171521020e70c4fd433ea2fdac8bee67bfd19e014646c4605f4657f48f85d2'
AND (
token = 'KVRGD1NzKWApoz8Oru+oQvFov0U6e2TstM0nRDb9H3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)