UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WDpwGH1Mh669SrddiySoPekdyNvN9504sbVwl9MHxjU='
WHERE
key_id = '040472f62992ee3daab56e80be7b15dddbace56f5565b86d6a69a6dcbe8991d4'
AND (
token = 'WDpwGH1Mh669SrddiySoPekdyNvN9504sbVwl9MHxjU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)