Hi Alejandro,
An expanded scrollcontainer gets an additional class: .mx-scrollcontainer-open. So you could manipulate the styling if the button is located within that container. For instance, you can do something like:
.mx-scrollcontainer-open .mx-name-sidebarToggle1 .glyphicon {
transform: rotate(180deg);
transition: all .2s ease-out;
}