Distância Grande Círculo do MySQL (fórmula Haversine)

Eu tenho um script PHP que obtém os valores de Longitude e Latitude e os insere em uma consulta MySQL. Eu gostaria de torná-lo apenas MySQL. Aqui está o meu código PHP atual: if ($distance != "Any" && $customer_zip != "") { //get the great circle distance //get the origin zip code info...