An affinity threshold for maximum efficacy in anti-PD-1 immunotherapy