The fifth-generation (5G) and beyond networks are designed to efficiently utilize the spectrum resources to meet various quality of service (QoS) requirements. The unlicensed frequency bands used by WiFi are mainly deployed for indoor applications and are not always fully occupied. The cellular industry has been working to enable cellular and WiFi coexistence. In particular, 5G New Radio in unlicensed channel spectrum (NR-U) supports the uplink and downlink transmission on the maximum channel occupation time (MCOT) duration. In this paper, we consider maximizing the total throughput of both downlink and uplink in NR-U by jointly optimizing the time and power allocation during MCOT while ensuring fair coexistence with WiFi. Fairness is guaranteed in two steps: 1) tuning the access related parameters of NR-U to achieve proportional fairness, and 2) including 3GPP fairness from the throughput perspective as a constraint in NR-U throughput maximization. Numerical analysis and simulation have demonstrated the superior performance of the proposed resource allocation algorithm compared to conventional deployment strategies.