IoT Consist of interrelated devices such as digital devices, mechanical devices, computer system, sensors, etc. for transceiving the information over the network. The scalability is essential to enhance the energy utilization and the performance of the environment, while mobility enhances the coverage of the system. Key management is vital for encrypted information transmitted over the network. Although many key management techniques are available, still it is a challenging issue concerning energy and computational cost, so robust key management technique is required that guarantees the required security requirements. In this paper, we proposed a cognitive key management technique (CKMT). The CKMT mechanism is helpful for key management and maintenance in a cluster-based mobile environment that reduces the rekeying process which is required for the mobile node when it enters the new location area, thereby reducing the computational overhead and enhances the scalability to large size network which makes our scheme more robust because strong key management technique is important while providing security services. Initially, we form a cluster, then Cluster-Head (CH) will be elected, it's a coordinator node that acts as a key manager. We also made an assumption that the sensors and Cluster-Heads are mobile, they can be able to shift from one position to another. This CH oversees and keeps up the private keys of sensors. When CH changes its location, it will hand over its responsibilities to the other CH in the network for uninterrupted communication. Our scheme uses local keys and foreign keys for each node and pairwise key is used only for the common nodes among the cluster so our scheme reduces the computational cost in the network under mobility condition. The results show that our proposed algorithm lowers the overhead in terms of computational costs, energy consumption, and delay.