Within the beamlines of diffraction-limited storage rings, the liquid-metal-bath cooling scheme is a prevalent choice for the cooling of high-heat load mirrors. This study employs the finite element analysis method to evaluate the thermal deformations of liquid-metal-bath horizontally deflecting mirrors in the Hefei Advanced Light Facility. In particular, we introduce a novel optimization strategy to obtain the optimal thermal deformation scenario, which also satisfies mechanical design requirements. Moreover, a concurrent optimization approach across multiple structural parameters of mirrors is adopted to attain globally optimal thermal deformation. Following the optimization of the mirror's structural parameters, the curvature radius increases to 227 km, while the residual slope error decreases to 36.3 nrad at 6eV in the meridian direction. The ray tracing analysis of the beam demonstrates a considerable reduction in the influence of thermal deformation on the beam's focal point. This work proposes an optimization method for designing cooling schemes under mechanical constraints.