Optimality in kinetic proofreading and early T-cell recognition: revisiting the speed, energy, accuracy trade-off