UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9sdL1xUGi5Lucf2+dOSWPFMclGvp0B3ikJNpxZd2sY4='
WHERE
key_id = '6b2fb43f4eba7de570cc1a8169149c97b0554ba947e06f807f83841266f1f346'
AND (
token = '9sdL1xUGi5Lucf2+dOSWPFMclGvp0B3ikJNpxZd2sY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)