Andy Murray recorded his first singles victory on the ATP Tour since January with a three-set victory over Tennys Sandgren at the Zhuhai Championships in China.