Matt locks Joe in the cell and walks into the office area and the key ring he had in his hand disappears from the time he locked the cell to when he got back into the office area.
After Matt locks Pike in the cell (Joe is still in the other cell), he hangs the key ring on a hook in the office area, then he leaves the building, with no one there to keep an eye on the prisoners. In this situation, anyone could come in, unlock the cells and free the prisoners.
After Matt locks Joe in the cell, he leaves the building and doesn't have Festus, or anyone else, there to keep an eye on the prisoner.