We study the properties of K andK mesons in nuclear matter at finite temperature from a chiral unitary approach in coupled channels that incorporates the s and p waves of the kaon-nucleon interaction. The in-medium solution accounts for Pauli blocking effects, mean-field binding on all the baryons involved, and π and kaon self-energies. We calculate K andK (off-shell) spectral functions and single-particle properties. TheK effective mass gets lowered by about −50 MeV in cold nuclear matter at saturation density and by half this reduction at T = 100 MeV. The p-wave contribution to theK optical potential, due to , , and * excitations, becomes significant for momenta larger than 200 MeV/c and reduces the attraction felt by theK in the nuclear medium. TheK spectral function spreads over a wide range of energies, reflecting the melting of the (1405) resonance and the contribution of Y N −1 components at finite temperature. In the KN sector, we find that the low-density theorem is a good approximation for the K self-energy close to saturation density due to the absence of resonance-hole excitations. The K potential shows a moderate repulsive behavior, whereas the quasiparticle peak is considerably broadened with increasing density and temperature. We discuss the implications for the decay of the φ meson at GSI Schwerionen Synchrotron energies as well as in the future Facility for Antiproton and Ion Research project.