UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8AdtH+Gj4P+TNGRWJ6F13P8vRa1F28x1X8ziHf/9qYY='
WHERE
key_id = '538f0434f01f0f3e88b70013fc4c7b47b33e712e733e43f6fbb78e6a3d0a3bb1'
AND (
token = '8AdtH+Gj4P+TNGRWJ6F13P8vRa1F28x1X8ziHf/9qYY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)