This reminds me of the “first commandment with a promise”, obeying your parents.
(Ephesians 6:2 KJV) Honour thy father and mother; (which is the first commandment with promise;)Here we have a similar saying. Solomon is speaking but through the inspiration of the word we are being given a promise.
There are consequences for obedience. This is one of the good ones. Accepting and living by the wisdom of God will increase your years. I think part of that also is that the years will be better.
Think of it as a two-fer. Longer life is granted to us with an assurance that it will be quality as well as quantity.
So? Take the long range view. Remember that with wisdom it will be a longer range view.