Both of the guards have a handle. If the guard that always lies pulls his handle, then the minecart will divert to the second track. If both guards pull their handle, the prisoners will be released. One of the handles is covered by a wooden box, where half of the wooden planks of the original box have been replaced by new ones cut from a tree that fell when nobody was around. If guard A is taller than guard B, are we getting paid for this quest?
I mentioned in the adjacent comment thread that circumstance: if one of them gives a verifiable answer then it is solved, if neither of them know: that requires one of them does know and is lying and one actually doesn’t know, which is a very odd stipulation, but you can just ask them any other question with one true answer. “What is 2 + 2?”
For this concept to work you need to only be allowed one question, I reckon