You'll get through customs in a couple of minutes (unless you are stopped for extra checks). It's immigration that can take time. If you have booked this as a single ticket and you meet the minimum connection time then the airline is responsible for getting you on the next available flight at no extra cost.