The accurate and timely diagnosis of skin cancer is crucial as it can be a life-threatening disease. However, the implementation of traditional machine learning algorithms in healthcare settings is faced with significant challenges due to data privacy concerns. To tackle this issue, we propose a privacy-aware machine learning approach for skin cancer detection that utilizes asynchronous federated learning and convolutional neural networks (CNNs). Our method optimizes communication rounds by dividing the CNN layers into shallow and deep layers, with the shallow layers being updated more frequently. In order to enhance the accuracy and convergence of the central model, we introduce a temporally weighted aggregation approach that takes advantage of previously trained local models. Our approach is evaluated on a skin cancer dataset, and the results show that it outperforms existing methods in terms of accuracy and communication cost. Specifically, our approach achieves a higher accuracy rate while requiring fewer communication rounds. The results suggest that our proposed method can be a promising solution for improving skin cancer diagnosis while also addressing data privacy concerns in healthcare settings.