Generally, the least time in the air the better, but it's mostly a maximum miles per gallon over the earth thing and this depends on winds. In the time/fuel burn equation, there is always a "sweet spot", a speed/power configuration that gives the most miles per gallon for "air distance" traveled, but how this translates to a maximum distance covered for a given amount of fuel depends on the headwind/tailwind component.
If headwinds are strong, the most efficient speed may be faster than what is optimal for winds that are light or there is a tailwind. It's easy to see if you take it to the extreme; imagine you are in an airplane that cruises most efficiently at 50 mph and can go 80 mph. Most miles per gallon air distance is at 50, but if you have a 50 mph headwind, you aren't going anywhere are you, and your actual miles per gallon is 0. Dial that ridiculous example back to something more reasonable and you can see that there are subtle variations with winds that have to be taken into account.
Generally speaking if there is nil wind or a tail wind, you would fly at the most efficient miles per gallon speed but with a really strong tailwind it might be better to slow down even more for best earth miles per gallon. If there is a headwind, the optimal speed might be little faster than the max air miles per gallon speed to use the least fuel to get there.
There was an incident once where an RJ crew had to do an IFR diversion with the flaps stuck at 45 degrees and the crew had to decide what speed to fly at, limited to flap extension speed and with all that drag, taking into account whatever headwind/tailwind they had. They landed at their alternate with 500 lbs on board, about 10 minutes worth. Talk about pressure to get your calculations right...