Presumably you will already have your boarding pass for the second flight and your bags (if any) will be checked through? Then there isn't much difference in the airport procedures if you go out or not. Rarely you may get to skip security when in transit. If you're in economy there may be long queues for transit security, not so much when entering from landside.
Now that the train is in operation you don't need to mess around with buses or taxis. I would happily spend 2 hours riding the train back and forth, if you wish you can also walk around the Corniche and Souq Waqif, although it's all rather same-y. The Museum of Islamic Art is often recommended but is currently closed. Personally I like walking around suburbs and the worker neighbourhoods, although it can be a bit intimidating the first time and maybe not recommended in the dark as it will be on your schedule.