China requires passport with at least 3 months validity for 72/144 hour transit without visa, I assume it will be the same for 24 hour transit. You will also need to satisfy entrance requirement to Japan. If your flight is this evening, what can you really do other than going to the airport early so you have time to change your connection to a shorter one if needed? It's not like you can get a new passport by then.
https://en.nia.gov.cn/n162/n227/c116266/content.html