Honestly, I wouldn't use either one of them unless there's some context that I'm not aware of. If the teacher asked me why I was late, I would simply say:
"I would have gotten to class earlier if I lived near the school"
In any event, the use of "had" means that both of these events are long past. If I were no longer going to school and was telling a story about something that happened while I was in school, I would say:
"I would have gotten to class earlier if I had lived near the school."