Your Carmax offer will also be a lowball, guaranteed. You can negotiate better through the dealer you are buying from. However, in many states, you will not receive a sales tax savings for the value of your trade vehicle when leasing. If that is the case in your state, sell your car yourself and apply the proceeds to the lease payoff.
However, if you are set on trading it in, research your trade values on kbb and NADA, then shoot for a grand above the best book value. There are often cash to dealer incentives that we aren't aware of that help the dealers "give more" for a trade than what the car is worth. I always tap into that. On my 2015 ES350, the initial dealer offer was $20,100. NADA clean-trade value was $22,550. I ended up getting $23,400 for it. When I factored in sales tax savings at 6.25%, the actual all-in trade value was $24,862.50 which was $138.00 below the NADA clean retail value. AT that point it was worth it to me to trade it in.
Bottom line is, know exactly the minimum you will accept for your trade and the maximum you are willing to pay for the new car BEFORE you starting negotiating. Then drag the process out as long as you can to get the figures you need. NEVER be afraid to walk if they won't meet your expectations.
Good luck!