The exit is the middle door.
The guard on the left states that the door to freedom is the right-hand door and therefore not his own. If on the other hand he is lying, then similarly he is not the guard of the door to freedom. Moreover, if the right-hand door were the way out, then its guard must have truthfully stated so. This leaves the door in the middle. Thus the door on the right is to the execution room, and the one on the left is to the dungeon.