Synchronization of two animations

I have a character walking animation that consists of two animations with the same number of frames. Separate animation of the legs and separately animation of the hands. For proper walking, I need the animations to work in sync. The character’s arms can perform other actions, such as a block or punch, and then return to the walking animation again. I want the arm animation to always run in sync with the leg animation. What are some ideas to keep the two animations in sync?