UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IgMsQ8bz7emUT0nO54ZY9O9sziWtYxtkkr95UW7WrT4='
WHERE
key_id = '9843801b8a2559145c5b04706bac7f9f88a4155b761057e724043881c7f6ee80'
AND (
token = 'IgMsQ8bz7emUT0nO54ZY9O9sziWtYxtkkr95UW7WrT4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)