Store a Boolean variable like so:
var hasKeyBeenPressed = new Boolean(0);
In your setTimeout function, change this value to true. On your conditional checking for the keycode, check and ensure the setTimeout function only executes when this boolean value has been set to false.
var hasKeyBeenPressed = new Boolean(0);
onkeyup = function(e) {
if (e.keyCode == 77 && hasKeyBeenPressed == 0) { // the 'm' key
setTimeout(function () {
hasKeyBeenPressed = 1;
... // my set timeout stuff
}
}
}
Under these conditions, your function will execute only one time.
If you need some persistence, consider using sessionStorage.