2nd one is better.
to mount it, just drill holes in the bottom for a plate that is Z or L shaped so it stands off of whatever you mount it to. or spacers and straight through bolts/screws.

as for vibrating off, no. My issue is heat in the engine compartment will easily exceed 150 F and probably closer to 200F in the summer.
Either mouting vertically or horizontialy you may have problems if it is not solidly mounted to the box.

It looks like your design has a place for 4 holes. Just have them actually be holes. Computer board stand offs are fairly common and mount them in the box that way.

I know they will stick out past the bottom, but you need to mount the box off the mounting surface anyway to get the wires to clear.

oh and you may want to number at least 1 of the pins for wiring, so people have a reference when they look at the board. if not numbering them all, so your instructions can explain which one goes where.