First Provably Optimal Asynchronous SGD for Homogeneous and Heterogeneous Data