This might sound daft but have you tried driving to another location and trying the key again ? This happened to me a few years ago when my remote function stopped working at home but when I later went to the shops it was fine. I came home and it stopped again ! This went on for a couple of days before righting itself. My only thought was signal interference from some source such as phone mast or remote doorbell close to my drive ?
Anyway it never happened ever again !