According to the optical Stark deceleration theory of using a stationary quasi-cw red-detuned optical lattice to slow and trap an arbitrary pulsed molecular beam, we propose a novel idea of using a modulated optical lattice instead of a stationary one to realize a multistage optical Stark deceleration. We analyze the motion of the decelerated molecules inside the optical decelerator, and study the dependence of the velocity of the decelerated molecular packet on the synchronous phase angle and the number of the deceleration stages (i.e. half the number of the optical-lattice cells) by using the Monte-Carlo method. The simulation results show that it takes longer time for the molecules to reach the detector as the number of the deceleration stages increases. The decelerated molecular wave packets are gradually separated from the large wave packets of the original molecular velocity distribution. And the higher the number of the deceleration stages, the lower the decelerated molecular speed is. In addition, we also study the influence of the initial phase angle of synchronous molecules under the same conditions. It is demonstrated that the higher the initial phase angle of synchronous molecules, the lower the decelerated molecular speed is and the smaller the number of molecules in the deceleration wave packet, so the phase space is compressed. The result also shows that the modulated optical Stark decelerator does not have the process of molecular free flight, and thus improving the efficiency of deceleration for molecules. The ultra-cold molecules can be trapped in the optical lattice by rapidly turning off the modulation signal of the lattice. Comparing with the previous scheme, the doubled number of the deceleration stages is reached in the same optical lattice length since a modulated optical lattice is used. For a length of optical lattice of 3.71 mm, theoretical simulation results demonstrate that the speed of methane molecules is decelerated from 280 m/s to 172 m/s. Comparing with the previous results from 280 m/s to 232 m/s, the deceleration effect is improved by 26%. Our scheme can not only obtain an ultra-colder molecular packet under the same molecular-beam parameters and deceleration conditions, but also be directly used to trap the slowed cold molecules after the deceleration without needing to use other techniques for molecular trapping.