Superconducting phase qubit coupled to a nanomechanical resonator: Beyond the rotating-wave approximation