UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'owWHCbmo8LhjMvpzfgWTJiK3jlVXWvQhgOBX12rS268='
WHERE
key_id = '9659e65272fa47c1d642a62f98de943f389c105ae72b509f09d2b8a4614ad410'
AND (
token = 'owWHCbmo8LhjMvpzfgWTJiK3jlVXWvQhgOBX12rS268='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)