They are all grammatical but have slightly different meanings. You have to wait 5 minutes until the box opens. (if the box opens at 8 pm then you wait from 7:55 to 8) You have to wait 5 minutes before the box opens.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.