Quantum key distribution (QKD) is a technology that can resist the threat of quantum computers to existing conventional cryptographic protocols. However, due to the stringent requirements of the quantum key generation environment, the generated quantum keys are considered valuable, and the slow key generation rate conflicts with the high-speed data transmission in traditional optical networks. In this paper, for the QKD network with a trusted relay, which is mainly based on point-to-point quantum keys and has complex changes in network resources, we aim to allocate resources reasonably for data packet distribution. Firstly, we formulate a linear programming constraint model for the key resource allocation (KRA) problem based on time-slot scheduling. Secondly, we propose a new scheduling scheme based on graded key security requirements (GKSR) and a new micro-log key storage algorithm for effective storage and management of key resources. Finally, we propose a key resource consumption (KRC) routing optimization algorithm to properly allocate time slots, routes, and key resources. Simulation results show that the proposed scheme significantly improves the key distribution success rate and key resource utilization rate, among others.