Raster-scan optoacoustic mesoscopy (RSOM), also termed photoacoustic mesoscopy, offers novel insights into vascular morphology and pathophysiological biomarkers of skin inflammation in vivo at depths unattainable by other optical imaging methods. Using ultra-wideband detection and focused ultrasound transducers, RSOM can achieve axial resolution of 4 micron and lateral resolution of 20 micron to depths of several millimeters. However, motion effects may deteriorate performance and reduce the effective resolution. To provide high-quality optoacoustic images in clinical measurements, we developed a motion correction algorithm for RSOM. The algorithm is based on observing disruptions of the ultrasound wave front generated by the vertical movement of the melanin layer at the skin surface. From the disrupted skin surface, a smooth synthetic surface is generated, and the offset between the two surfaces is used to correct for the relative position of the ultrasound detector. We test the algorithm in measurements of healthy and psoriatic human skin and achieve effective resolution up to 5-fold higher than before correction. We discuss the performance of the correction algorithm and its implications in the context of multispectral mesoscopy.