UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/Uz+v9waqnYcPCjhPVLDCO1SrdL6mCJtP0A1gww6jfs='
WHERE
key_id = 'd749393543b3065ae19ab0a65793e45a6fd94e2114fb94394b921d4f0c901fa6'
AND (
token = '/Uz+v9waqnYcPCjhPVLDCO1SrdL6mCJtP0A1gww6jfs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)