Depends on interest rate and how close to retirement you are.
If your interest rate is locked in at 3% for 30 years, your return from the market will almost certainly be better.
Further from retiring, also less reason to pay it off, but in retirement, generally you want to lower your market risks which means less expenses (mortgage payments) that come out of income that is subject to market risk (ie stocks).