This paper focuses on the performance of wireless sensor networks characterized by a hybrid topology composed of mobile and static sensor nodes. The Routing Protocol for Low power and lossy networks (RPL), which is standardized as an IPv6 routing protocol for low power and lossy networks, uses the trickle timer algorithm to handle changes in the network topology. However, this algorithm is not well adapted to dynamic environments. This paper enhances the trickle timer in order to fit with mobility requirements. Most of previous works have improved this algorithm without considering the random movement of nodes. In this work, the proposed timer algorithm takes into consideration the random trajectory of mobile nodes, pause time and nodes velocity. It is also dynamically adjusted to prevent from node disconnections. The performance of the modified protocol is evaluated and compared with native RPL, MERPL and RPL with reverse Trickle. The results show that our protocol optimization offers better performance.