Maybe you are looking at the problem from the wrong end?
As long as you don't have produced exceptional research during your phd (think Einstein in the patent office), graduated from a famous university, and are well connected and politically savvy, you can forget about a typical academic career.
I don't know the actual numbers, but we are probably talking about 10% of phd students getting a postdoc position and then 10% of the postdocs getting a faculty position, it is probably even less.
So better think about your strength! You have been working full-time, and honestly, I think this is a great plus. By design, people in academia tend to be pretty much disconnected from the 'real world', to the extend that it makes them difficult to employ. So ask yourself, what do you have that the usual graduate doesn't have?
Another plus I see for you is that you have done a phd at the age of 40, and this while working somewhere else. You've shown strong dedication and commitment. I salute you for this! I am younger than you, and I don't think I would have the nerve to go through my phd again.
While dedication and commitment won't get you into a faculty position in a big research university, there are other places where someone with your experience could have an advantage. I am thinking about community colleges, adult education or similar. You will have much more street cred than a younger graduate.
You said that you made some bad life choices. Getting your phd you have clearly demonstrated that you could overcome them by yourself (and a phd in mathematics is no small achievement, everyone knows that).
Whatever choices you made then, you now have an experience that other people don't have. Let's say (and I am just making up worst-case stuff, just to show that even something really bad could give you a valuable experience. I am in no way suggesting you had anything do to with drugs).
Let's say you were heavily into drugs, smuggling, and spent 10 years in prison. Sounds really bad, but on the other hand, there will be very few people with that background and a deep understanding of mathematics. That could make you predestined for a job doing statistics in a related field. 10 years down the line, I could see you as a director of a health-related NGO doing research.
Now as far as research goes, doing a phd only touches the surface of what doing research really means. Research is an extremely hard field, many researchers will never find anything important in their lives and their only contribution will be a bunch of papers that no one actually read.
To be a successful researcher, you'll need to be a politician, a manager, a marketing specialist, a grant-writing specialist, a diversity specialist (grant applications are judged not only on their scientific merit, but frequently on adherence to the political agenda dujour). If you are not 100% confident that you can meet all of these requirements, or don't have an independent source of income if your plans fail, I would not risk it (personal opinion).
On the other hand, a lot of research gets done in non-university settings. You have to understand that there is some kind of firewall between academia and the real world. Academics look down on industry, because they think that they are the smartest and best, and industry looks down on academia, because they are so out of touch with reality.
Also, lives in industry and academia diverge, the academics don't want to be seen with the dumb industrialists, and the industrialists are embarrassed if the academics see their big houses and expensive cars. So just take into account that a lot of people in your academic circles will not be aware of many options outside of academia, even though many jobs will be just as challenging and interesting, maybe even more so.
Mathematics plays a big role in many fields now, you just need to find the right place. Be careful mentioning the word research when you look for a job, better say something along the lines of 'you would like to use your knowledge of mathematics and your job experience to improve product quality' or similar.
There are lots of research opportunities in quality control, signal processing, coding theory, electronic design automation (companies like Mentor Graphics), algorithms, machine learning. In many of these fields, most of the leading edge research is actually done outside of academia. Many of these companies will also allow you to work remotely. If publishing is important for you, a lot of companies will not have an issue with that (as long as it doesn't interfere with your main work), they might even like the publicity it gives them.