You only have to worry about the mileage and condition if you turn the car in at the end of the lease. If you look at your account you will see a payoff quote somewhere, that is a combo of your remaining payments and your residual value. If your residual is $12,000 and you have $2000 in payments left before turn in, you can "buy" the car for $14,000 (plus maybe a purchase option fee, depends on the lease). If you do this, mileage and condition don't matter because Nissan isn't getting that car back.
Here's where you have to do some calculations and prep. Go on KBB and get your trade in value estimate. Then, go to whatever is in your area for selling a car, check out the online places like car max, vroom, carvana, etc. Do ALL of them they will be different from each other. Is your sell value greater than your payoff amount? Great, don't you dare turn that car in.
If your trade/sell value quotes are LESS than what your payoff is, now you gotta figure what your turn in fee is (usually $300-500) PLUS your milage overage and how much the overage fee is per mile. If you're say, 20 cents per mile and 10,000 miles over, we'll, you know that if you turn in the lease they're going to send you a bill for $2300 (plus any other excess damage they deem to exist).
So, now you just compare your options, sell to third party, turn in to Nissan, or trade in at Mazda? Which one nets you the greatest benefit when plugging in all the numbers. Then do that.