Your layover length and your real free time are two very different numbers. This works out what is left after transit both ways and a realistic safety buffer. That final number is the one every other decision depends on.
Time is not the only thing that matters. These are the factors that turn a solid plan into a missed flight. Tick every one that applies and get a straight answer on whether leaving the airport is a smart call.
Leaving the airport means clearing immigration. Rules vary enormously by passport and destination, and some countries require a transit visa even if you never step outside the terminal. Check before you move.
Everything you calculated above, in one message: free time, risk level, and visa status. Send it to your inbox or copy it into your notes.