Better SQL timeout handling