From a 40yr old hospital doc...
AFAIK there isn't an age limit for applying to medical school. IF all goes well you will be a 40-41 yr old F1/2 ('house officer' equivalent) doing nightshifts, weekends, long-days. From my own personal experience (am an anaesthetics & ICU doctor) nights & long days are getting tough at this age.
If GP is where you're heading, then you'll have another couple of years of hospital specialties (like A&E, Obs & Gynae, Paeds, Medicine) and GP training. So you will be in your mid-late 40s before becoming a 'just cooked' GP.
If hospital specialties are what you're thinking of then it'll at least another 7 years before you're a new consultant (for most specialties...longer for some, shorter for some) so you'll be in your late 40s-50. Many hospital consultants are looking at trying to come off on-call rotas in their mid-fifties because the out-of-hours work at that age is too much (recognising that we're not at our best in the middle of the night, having been on-call for 70ish hours).
There are certainly a lot of mature students doing medicine & qualifying, but it is a massive decision. With the benefit of some more life experience you will find some elements easier than the fresh-out-of-school students/junior docs. But there are other things that will be more difficult (including the pay - which is pretty crap as a junior doc!).
You may also need to think about family (do you have a partner/children). Would you be self-funding/eligible for support? Allocation to jobs as a junior doc is deanery based and it's not unusual to be sent to opposite ends of the country to your family, putting massive strain on you all. Studying for post-graduate exams is all done in your own time so even once your qualified the job intrudes on family time. A lot of people are leaving medicine at the moment & burnout is increasingly being recognised as a problem.
Medicine is brilliant, but I wouldn't want to be starting all over now though. So, my advice is that - yes of course you can go to medical school, but really think hard about where you'll be in 15-20 years. Hope that's not too depressing a post... Good luck with the decision making.