It seems that what causes your symptoms is gout or pseudogout
Gout is a form of arthritis caused by urate crystals accumulation in joints. It is characterized by severe pain attacks. It typically affects people above 40 years old. It affects more males than females. The big toe base is the most affected joint. Pseudogout is similar with gout but it most often affects knee joint.