Only the second one works.
The first one is unreal - it means that the situation isn't real or the action won't happen.
If you had hand sanitizer = you don't have hand sanitizer.
If they had hand sanitizer, I would get one. (they don't have it)
The second one is a 'possible' conditional. We don't know that there is hand sanitizer but it is a real possibility.
If they have it, I'll get you one. If they don't, I won't.
Both forms are used to describe a present or future time. The first one (unreal) uses a past form of the verb to show that the situation is not true, rather than describing a past time.
If you want to read more about it, you can search for 'real and unreal conditionals'.