UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f7NYWbO1EGZp7QPZw70SeS5MWVLmpe2voCUwyb9N+rY='
WHERE
key_id = '4ba6ef27c12b76cd30f4972279705375cc2db5351e13fb09a69a7d63a44a6316'
AND (
token = 'f7NYWbO1EGZp7QPZw70SeS5MWVLmpe2voCUwyb9N+rY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)