Counting a loop

Here are some more thoughts:

    //loop runs every 20ms for 500 times = 10 seconds
    if ( count >= 500)  {

Not true. Your code takes some time to execute, so each loop takes more than then 20 ms delay you put in the beginning.

Because you only posted your loop() function, it's not obvious what conditions will wake your Arduino from sleep, making it harder for us to evaluate your code and help you. You should almost always post the entirety of your code.

Constants, such as your array of key-code values, should be declared outside of loop(). It's possible that a compiler will optimize this so that it isn't re-allocated every loop, but why take the chance. You can additionally help the compiler out by using the const keyword, such as:

const uint8_t keyuniversal[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };

As has been said already, you really need to understand BlinkWithoutDelay so that you can get rid of the delay() functions. Delay() is an incredible kludge that has almost no place in a piece of production code. It's just there for n00bs who want to get their feet wet.

Mark the time that something happened.
Set a boolean value to indicate that the "trigger" event has occurred and you are now waiting for the "response" behavior.
Every time through the loop, check what time it is now.
If the difference between "now" and "trigger time" is greater than the desired interval, then do the "response" behavior and clear the boolean flag.