I've had some experience mixing keyboards with heavy guitar. I'm a guitar player and my vocalist and I went up to northern California to mix a couple of songs a few years ago.
The song was written with the guitar riff as the main part. The piano/keys we added later by the producer, to add color.
First off, does your keyboard part HAVE to be there or is it just to accent the riff? If it's accent, ditch it. My band is total unhappy with the producer's mix of that song, the paino is way to high in the mix and distracts from the overall song.
I better example of a good mix of piano and heavy guitar is the Black Crowes. The do it just right. Faith No More & Led Zeppelin are another ones. But those bands use more "retro" sounding keys, electric piano, mellotron, etc. If you're going for Whitesnake or Europe, then good luck. That stuff never sounded good.
So to finish, if the keyboard part is what drives the song, mix it higher, put the guitar more in background. If it's the guitar riff that powers the song, then mix it up, use the keyboard as accent. The two parts will never live in the same place in the same mix, without sounding lame.
Peace.