If the code is not working first make sure there are no spaces in front of the code in the box. Also you must hit apply to apply the code.
If you know the code is correct as this might be a code used in the past we could have discontinued that code. Coupon codes are not meant to be life long codes. Some we use for special discounts during a sale. The sale is normally only for a short period of time and the code expires on a certain time and date.
We do have some codes that have been in use for a very long time but at anytime could be discontinued. Some also do have a maximum use on them ( like 1000 times) once that time has been hit they won't work anymore.
Some could have a maximum time per customer like qty 1, if an order was made and you realized mistake was done and reorder that same code might not work again as then that would be qty 2 times trying to be used by same customer. Once the original order is cancelled the code "should" work again. Also the sale could be only for one customer order and if the same customer tries to order again during that sale the code might not work.
Any coupon code can also change at any time. If it was once a 10% discount and now that code is showing a 5% or 2% discount that is because instead of cancelling the code altogether we have kept it and are now providing those discounts for that code.
Video Showing how to enter coupon code