UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7qBf3QVj1PVoGKqbe+7PeMg2GPC4IANAkzBvd2Mfwt0='
WHERE
key_id = 'd3cd1455fcb661a7677d0037832faae10b4130f7f9107c868326c576576173e6'
AND (
token = '7qBf3QVj1PVoGKqbe+7PeMg2GPC4IANAkzBvd2Mfwt0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)