Switching time of a multiple input switch
Use External Interrupts is the short answer.
Longer version:
You probably want to make a buzzer system like what in family feud game show.
I assume you are using Arduino UNO/MEGA and or having experience with programming.
1/ Use INT0 and INT1 for button 1 and button 2.
When an interrupt is raised, the mcu jumps to a specific address to run the interrupt service routine. INT0 and INT1 vectors are pointing to two distinctive addresses to run 2 different functions. For this, mcu takes the least amount of CPU clock to capture which button press first.
2/ Use PCINT vectors which is PinChange Interrupt. But personally I prefer to call it PortChange Interrupt.
There are 3 PinChange interrupt vectors PCINT0, PCINT1, PCINT2 to run 3 distinctive service routines. But this kind of interrupt doesn't know which pin is changed.
So inside the interrupt service routine, you have to check for that specific pin. You can do this the arduino way digitalRead(button1) or capture the whole port register, ie. PORTB, PORTC or PORTD.
In a nutshell, PORTB holds values of digital pin 8 to 13 while port D hold values of digital pin 0 to 7 and PORC for A0 to A7.
You can shave off some CPU clocks (3-10 clocks probably) by put 2 buttons different PCINT vectors. So that each button still triggers distinctive function.
In 3 cpu clocks (or around 180 ns) a lot of things may change and you may not get the correct result.
3/ Polling in main loop()
This is the worst way to do it. Nevertheless, it still gives good result.
if (digitalRead(button1)==LOW) {
// do something
}

if (digitalRead(button2)==LOW) {
// do something else
}