It is just common sense, you basically do a risk assessment of the situation and make your decision based on that.

Things like:

State of the kids, are they awake, restless, sitting quietly
Distance from where you are to where you need to go, like have you been lucky enough to get a pump close to the door
How busy is the service station
The weather of the day, hot, cold, wet, dry

I have done both, left kids in the car, taken the keys with me & locked it, and other times dragged kids out of the car to pay for the petrol, which can be a nightmare because of all the sweets/lollies by the counter. I make a judgement call for myself in each individual situation.

You do what is best for you, in your situation, at that point in time.