Unveiling the star formation history of the Upper Scorpius association through its kinematics