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