How to fix error "Your session has expired"
I've searched for an answer to this error that just showed up on our production Magento 2 (2.3.4-p2) site today. Every single one says the same thing, go here in core_config_data and change localhost to 127.0.0.1, but at least in 2.3.4, the record in that table with the base_url values does not have localhost, so there's nothing to change.
I don't know if an earlier version of 2.3 had these values in core_config_data, but they exist nowhere in 2.3.4-p2. I also flushed the cache at the command line, deleted all the directories under var/cache, but still the error continued.
I found through trial and error that clearing the cache in my web browser fixed the problem.
Just pointing out that this exact error may come up not because of the server, but because of your web browser, for whatever reason. It happened to me in the middle of troubleshooting a completely different problem. I signed out and tried to sign back in, but that also gave a similar error -- even though I was fine 3 hours earlier.
The only thing that happened in those 3 hours was I came back to test the same problem I was working on before and was stopped by this error. So, I didn't change anything on the server to start the problem, it just happened on my FireFox web browser, which I only use to work on Magento 2.
Use 127.0.0.1 instead of localhost for that execute below query.
UPDATE `core_config_data` SET `value` = 'http://127.0.0.1/magento/' WHERE `core_config_data`.`path` = 'web/unsecure/base_url'; UPDATE `core_config_data` SET `value` = 'https://127.0.0.1/magento/' WHERE `core_config_data`.`path` = 'web/secure/base_url';
then clear cache by the cli command
php bin/magento cache:flush