Ultrafast dynamics of a molecular rotor in chemical and biological nano-cavities