Automatic switching between external 5V and USB bus power supplies
Please check this circuit (I have not simulated this and used some random mosfets). 

CASE I: VBUS-ON EXT5V-OFF: OUTPUT voltage = VBUS - Vf (Forward diode drop of D1, select D1 with low Vf). R1 will pull Gate node of Q2 and Q3 to OUTPUT voltage and turns them OFF , no power will flow to EXT5V.

OUTPUT ~ VBUS

CASE II: VBUS-OFF EXT5V-ON: OUTPUT voltage = EXT5V - Q2 and Q3 drop due to Rdson. Voltage at R2 turns off Q4 and turns on Q1. Q1 pulls Q2 and Q3 Gate nodes to GND potential and turns them ON. D1 blocks power flow to VBUS.

OUTPUT ~ EXT5V

CASE III: VBUS,EXT5V-ON OR Plugging EXT5V after VBUS: In this scenario circuit will prioritise EXT5V over VBUS. Potential at R2 will shutdown VBUS path and Turns on Q2-Q3 path. 

OUTPUT ~ EXT5V