My wife and I are around the same age, and we had many of the same considerations when we moved out of Boston. There is a very short list of towns I would even consider based upon your criteria.
The town we live in--Winchester--is a painfully obvious choice given your criteria. It's six miles North of Boston (or a twelve-minute train ride), a beautiful town, and boasts the Middlesex Fells--a 2,000 acre park and nature preserve with hiking, mountain biking, etc. It is also the most dog-friendly town you could ever hope to find.
Winchester is bordered by both 93 and 95, so access to Andover (reverse commuting) would be a snap. Condos are relatively affordable--houses much less so. It's a "family" town--and nobody would move there for the nightlife--but it's a ridiculously easy drive into Boston for dinner, shows, etc (it usually takes us under 10 minutes). It also offers that walkable downtown of which you speak with one exceptionally good restaurant (Catch) and several decent ones.
Most people will tell you that Winchester is great--if you have a family (it has the best school system in the state--which is a nice safeguard aginst depreciation). I would argue just the opposite. We recently had our first child and are now looking to move out further so we can get a bigger house/yardfor the money. Most of the near suburbs of Boston are a little dense for small children.
Affordability isn't really the Boston area's strong suit (and Winchester is certainly no exception)--but would you ever consider a condo? Even the nicer towns are manageable if you don't need a big house to accommodate a family.
40's and child-free in the Andover area? No thanks. Lexington and Arlington are nice towns, but nowhere near as accessible to either Andover or Boston. Davis Square, Somerville and Charlestown both have a lot of cultural offerings, but are a little too young/busy/dirty/noisy for most 40-somethings.
Feel free to drop me a line if you need some other suggestions--each town around here definitely has it's own distinct "flavor" and I would hate for you guys to choose the wrong one. I'm at email@example.com.