UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OW4yefE14RhMlIdb82LEVrFv4hS4TiYl6K9FMYAQ9uA='
WHERE
key_id = 'ae29b9e706d83821896ac3b3f960be555309462523971d88a0c08f1b9c9fe78f'
AND (
token = 'OW4yefE14RhMlIdb82LEVrFv4hS4TiYl6K9FMYAQ9uA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)